package com.gitee.minimalismstyle.fresh.common.core.validate

class IntValueValidate : ValueValidate {

    override fun check(value: Any?, params: String?): ValidateResult {
        return if(value == null || value.equals("")){
            ValidateResult(true)
        } else {
            val isInt: Boolean = value.toString().toCharArray().all { it.isDigit() }
            if(isInt){
                ValidateResult(true)
            }else{
                ValidateResult(false, "必须是整数")
            }
        }
    }
}